<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/webwork" prefix="ww"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    <title>Item Administration</title>
  </head>
	<body onload="document.newItemForm.newItemName.focus();">
        
<%@ include file="/admin-header.html" %>

 	<form name="updateItemsForm" action="UpdateItems.action" method="post">
	<table border="1">
                <tr>
			<th>SKU</th>
                        <th>Name</th>
                        <th>Description</th>
			<th>Cost</th>
                        <th>Inventory</th>
                        <th>Valid</th>
                        <th>Invaid Date</th>
		</tr>
		<ww:iterator value="items">
		<tr>
			<td><ww:property value="%{sku}"/></td>
			<td><ww:textfield size ="25" name="itemNameMap[%{id}]" value="%{name}"/></td>
			<td><ww:textfield size ="35" name="itemDescriptionMap[%{id}]" value="%{description}"/></td>
			<td><ww:textfield size="8" name="itemCostMap[%{id}]" value="%{cost}"/></td>
                        <td><ww:textfield size="5" name="itemInventoryMap[%{id}]" value="%{inventory}" maxlength="5"/>
                        <td><ww:select
                            name="itemValidMap[%{id}]"
                            list="#{\"1\" : 'Valid', \"0\" : 'Discontinued'}"
                            value="%{valid.toString()}"
                            required="true"
                            /></td>
                        <td><ww:if test="valid == 0" ><ww:property value="%{invalidTimeStamp}" /></ww:if>
                        <ww:else>&nbsp;</ww:else></td>
		</tr>
		</ww:iterator>
	</table>
        <input type="submit" value="Commit changes" />
        </form>
        
        <p/>
        
        <form name="newItemForm" action="NewItem.action" method="post">

	<ww:if test="hasActionErrors()">
	<ul>
	<ww:iterator value="actionErrors">
		<li style="color: red;"><ww:property /></li>
	</ww:iterator>
	</ul>
        </ww:if>
        

        <table border="1">
		<tr>
			<th>SKU</th>
                        <th>Name</th>
                        <th>Description</th>
			<th>Cost</th>
                        <th>Inventory</th>
                        <th>Valid</th>
		</tr>
		<tr>    
			<td><ww:textfield size="8" name="newItemSku"/></td>
			<td><ww:textfield size ="25" name="newItemName"/></td>
			<td><ww:textfield size ="35" name="newItemDescription"/></td>
			<td><ww:textfield size="8" name="newItemCost"/></td>
                        <td><ww:textfield size="5" name="newItemInventory" /></td>
                        <td>1</td>
		</tr>
	</table>
        <input type="submit" value="Add new item" />
        </form>
        <p/>
        <ww:a href="ListItems.action">Revert to Saved</ww:a> - 
        <ww:a href="LogOut.action">Logout</ww:a>
    </body>
</html>